#include "IFUException.h"
#include "FITSException.h"
#include "FITSImage.h"
#include "ImageSlice.h"
#include "IFUConf.h"
#include "IFUMap.h"
#include "GaussParameters.h"

#include <iostream>
#include <fstream>
#include <string>

#include <unistd.h>
#include <stdlib.h>

int main(void) {
  
  try{
  
    cout << "Testing FITSImage" << endl;
    cout << "Reading ..." << endl;
    
    FITSImage* img = new FITSImage("ifu.fits");
    
    ImageSlice *coluna = img->getColumn(0);
    
    for (int i = 0; i < coluna->size(); i++)
      cout << coluna->get(i) << endl;

    //cout << "pixel 0,0 " << img->getPixel(0,0) << endl;
    //cout << "pixel 0,0 " << coluna->get(0) << endl;


    delete coluna;
    
    //cout << "OK" << endl << endl;

  } catch (FITSException e) {

    e.what();

  }

  /*
  try {

    cout << "Testing GaussParameters" << endl;
    GaussParameters par = GaussParameters();
    par.add("ph0.par");
    par.add("ph1.par");

    double *x0 = par.getX0(1);
    double *sigma = par.getSigma(1);
    double *amp = par.getAmp(1);

    int picos = par.getNPeaks();

    for (int i = 0; i < picos; i++)
      cout << x0[i] << " " << sigma[i] << " " << amp[i] << endl;

    delete []x0;
    delete []sigma;
    delete []amp;
    
    cout << "OK" << endl << endl;
    
  } catch (IFUException e) {
      
      cout << endl;
      
  }
    
  try{
    
    cout << "Testing IFUConf" << endl;
    IFUConf conf = IFUConf("ifu.conf");
    conf.dump();
    
    cout << endl;
    
    cout << "Testing IFUMap" << endl;
    IFUMap mapa = IFUMap("ifu.map");
    mapa.dump();
    
  } catch (IFUException ex) {
    
  }

  */

  return 0;

}
